#!/usr/bin/python3py
#-*-coding:utf-8-*-

import os
import sys
import config
import platform

#获取脚本文件的当前路径
def curFileDir():
     #获取脚本路径
     path = sys.path[0]
     #判断为脚本文件还是py2exe编译后的文件，
     #如果是脚本文件，则返回的是脚本的目录，
     #如果是编译后的文件，则返回的是编译后的文件路径
     if os.path.isdir(path):
         return path
     elif os.path.isfile(path):
         return os.path.dirname(path)

         #判断当前系统
def isWindows():
  sysstr = platform.system()
  print (sysstr)
  if("Windows" in sysstr):
    return 1
  else:
    return 0

#兼容不同系统的路径分隔符
def getBackslash():
	if(isWindows() == 1):
		return "\\"
	else:
		return "/"

#当前脚本文件所在目录
parentPath = curFileDir() + getBackslash()

#config
libPath = parentPath + "lib" + getBackslash()
channelWritterPath = libPath + "packer-ng-2.0.0.jar"

print (parentPath)

#验证渠道打包(只验证应用宝)
outputFilePath = parentPath + "channels" + getBackslash()
protectedSourceApkPath = outputFilePath + config.protectedSourceApkName
verifyApkYingYongBaoPath = protectedSourceApkPath[0 : -4] + "_aligned_signed-xiaomi.apk"

#验证渠道
writeChannelShell = "java -jar " + channelWritterPath + " verify " + verifyApkYingYongBaoPath
os.system(writeChannelShell)

print ("\n**** Finish! Please Check the 'Channels' Folder in your root Floder ! ****\n")



